package main

import (
	"fmt"
	"sync"
)

var wg sync.WaitGroup

func sum(n int) {
	defer wg.Done()
	sum := 0
	for i := 0; i < n; i++ {
		sum += i
	}
	fmt.Printf("sum from 1 to %d is %d\n", n, sum)
}

// func main() {
// 	wg.Add(1)
// 	go sum(100)
// 	wg.Wait()
// 	fmt.Println("finish")
// }
